<template>
    <div>
        <ul class="menu_top_list ">
            <li @click="add()">
                <span class="iconfont icon-fanhui"></span>
            </li>
            <li>评论</li>
            <router-link tag="li" to="/home" class="index-btn"></router-link>

        </ul>
        <div class="max-top mgb32">
            <div id="page">
                <div class="Pinglunfont book_bk_qs1 ">
                    <ul id="Pinglun_body" style="margin:0.1rem;" v-for="(items, index) in pink" :key="'I-nfo-' + index">
                        <li class="clear">
                            <figure>
                                <img :src="items.img" width="80" height="80">
                            </figure>
                            <div class="Pinglun_Content2">
                                <span><b>{{ items.name }}</b><em></em>
                                    <br>{{ items.time }}</span>
                            </div>
                            <p>{{ items.pad }} </p>
                        </li>
                    </ul>
                    <ul id="Pinglun_body" class="max-bom"  v-for="(item, index) in downloadLists "
                    :key="'I-nfo' + index">
                    <li class="clear">
                        <figure>
                            <img :src="item.img" width="80" height="80">
                        </figure>
                        <div class="Pinglun_Content2">
                            <span><b>{{ item.name }}</b><em>{{ item.frit }}</em>
                                <br> {{ item.time }}</span>
                        </div>
                        <p>{{ item.pad }} </p>



                    </li>
                </ul>

                <div class="investment book_view_bom">
                    <input type="text"  v-model="text" @keydown="textIsSet">

        </div>
                </div>

            </div>
        </div>

    </div>
</template>
<script>
import { getPink } from '@/api/home';
import { Toast } from 'vant';

export default {
    data() {
        return {
            allGame: [],
            flag: false,
            play: false,
            indexSwiper: 0,
            index1: 1,
            rbq: null,
            active: 0,
            list: [],
            guan: false,
            pink: [],
            text: null,
            downloadLists: []
        }
    },
    methods:{
        add(){
            this.$router.go(-1)

        },
        getNowTime() {
            var date = new Date();
            var time = date.getFullYear() + '/' + (date.getMonth() + 1) + '/' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
            this.newTime = time;
        },
        // 发送评论
        textIsSet(e) {
            if(this.text == ""){
                Toast("评论不能为空")
            }
            if (e.keyCode == 13) {
                console.log("text=>", this.text);
// 保存到store.
                this.$store.commit("downloadFun",
                    {
                        name: "时夜Saye",
                        img: require("../assets/images/头像.jpg"),

                        pad: this.text,
                        time: this.newTime,
                       
                    }
                );
                console.log("his=>", this.downloadLists);
                console.log(" this.nowTime=>", this.nowTime);

                // this.pink.pink.unshift({
                //   name:"时夜MoMo桑",
                //   img:require("../assets/images/头像.jpg"),

                //   pad:this.text,
                //   time:"2022/10/27 1:03:34",
                //   frit:'炎帝'
                // })

                this.text = ''
            }
        },

    },
    mounted() {

        getPink().then(data => {
            let arr = data.pink;
            console.log(arr);
            this.pink = data.pink;


        })




    },
    created() {
        this.getNowTime();//进入页面调用该方法获取当前时间
        clearInterval(myTimeDisplay);//销毁之前定时器
        var myTimeDisplay = setInterval(() => {
            this.getNowTime(); //每秒更新一次时间
        }, 1000);

        this.downloadLists = this.$store.state.downloadLists;
        // this. changeTab()
     
      

    },
    directives: {
        focus: {
            //根据focusState的状态改变是否聚焦focus
            update: function (el, value) {    //第二个参数传进来的是个json
                if (value) {
                    el.focus()
                }
            }
        }
    },
}
</script>
<style lang="scss" scoped>
 .comment-title .comment-url {
    padding: 5px 5px 0 31px;
    height: 54px;
    line-height: 21px;
    border-radius: 2px;
    border: 1px #ccc solid;
    box-sizing: border-box;
    color: #959595;
  
}



figure img {
    width: 35px;
    height: 35px;
}


img {
    border: none;
    vertical-align: middle;
}

#Pinglun_body li {
    color: #666;
    overflow: hidden;
    font-size: 12.89px;
}

#Pinglun_body li figure {
    float: left;
}

figure {
    border-radius: 17.577px;
    overflow: hidden;
    height: 35.154px;
    width: 35.154px;
    margin: 0 9.374px 0 0;
}

figure {
    display: block;
    /* margin-block-start: 1em;
    */
    margin-block-end: 1em;
    /* margin-inline-start: 40px;
    margin-inline-end: 40px;
    */
}

.Pinglun_Content2 {
    padding: 0 0 5.859px 0;
    display: flex;
    justify-content: flex-start;
    -webkit-box-align: center;
    align-items: center;
}

.Pinglunfont a {
    color: #666;
    text-decoration: none;
}

#Pinglun_body li p {
    text-align: left;
    margin: 5.859px 0 0 0;
    line-height: 1.8em;
    text-indent: 2em;
    font-size: 11.718px;
    border-bottom: 1px solid #eaeaea;

}

p {
    display: block;
    margin-block-start: 1em;
    margin-block-end: 1em;
    margin-inline-start: 0px;
    margin-inline-end: 0px;
}

.Pinglunfont a {
    color: #666;
    text-decoration: none;
}

.max-bom:last-child {
    margin-bottom: 150px
}

.post_but {
    width: 70.2px;
    height: 35.1px;
    color: #fff;
    font-size: 15.21px;
    background: #F90;
    border-radius: 18.72px;
    margin: 4px 0;
    display: -webkit-box;
    -webkit-box-pack: center;
    -webkit-box-align: center;
}


.book_view_bom {
    background-color: #F3F3F3;

    height: 40px;

    position: fixed;
    z-index: 90;
    width: 88%;
    bottom: 0;
    margin: 0 10px;
}

.investment {

    display: flex;
    z-index: 90;
    justify-content: center;
    padding-top: 5px;

    input {


        width: 90%;
        padding: 5px 0;
        border-radius: 10px;
        text-indent: 10px;
        border: 1px solid #999;
    }
}

#Pinglun_body li {
    // background: url(//rs.sfacg.com/web/m/images/xx.gif) repeat-x bottom;
    background-size: 2px;
}

.Pinglun_Content2 {
    B {
        font-weight: normal;
        font-size: 0.11rem;
        color: #3686d8;
    }

    em {
        margin-left: 5px;
        color: #ff6600;
        font-style: normal;
        font-size: 0.11rem;
    }
}


.max-top {}

.bd li img {
    width: 62px;
    height: 62px;
    border-radius: 8px;
    display: block;
    margin: 0 auto;

}

.bd li em {
    line-height: 1.4;
    margin-top: 5px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    word-break: break-all;
    -webkit-line-clamp: 2;
    text-overflow: ellipsis;
    overflow: hidden;
    font-size: 12px;
}

.bd li a {
    color: #333;
    text-decoration: none;
    outline: none;
}

.bd li {
    text-align: left;
    width: 62px;
    margin: 5px 0 0;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    word-break: break-all;
    -webkit-line-clamp: 2;
    text-overflow: ellipsis;
    overflow: hidden;
    line-height: 1.4;

}

.bd ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
}

.md-gameintr p {
    color: #959595;
    font-size: 14px;
    text-indent: 0 100px;
    text-align: justify;
    line-height: 22px;
    position: relative;
}

.manufacturer p {
    float: left;
    margin-left: 2%;
    width: 80%;
    color: #00cc7d;
    text-indent: 0;
}


.manufacturer em {
    float: left;
    width: 18%;
    color: #959595;
}

.manufacturer {
    margin-top: 10px;
    font-size: 14px;
}

.intr-content .intr-pp {
    width: 100%;
    text-indent: 2em;
    display: block;
    text-align: justify;

}

.intr-content {
    overflow: hidden;
    position: relative;
    font-size: 14px;
    line-height: 19px;
    width: 100%;
}

.gamedesc .gamedesc {
    z-index: 555;
    position: absolute;

}

.gamedesc .liste {

    z-index: 1;

    img {
        object-fit: cover;
    }

}

.gamedesc {
    position: relative;

    height: 208px;
    width: 355px;
    margin: 0 auto;

    img {
        width: 100%;
        height: 100%;
        display: block;


    }
}

.bd-tit {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    height: 20px;
    line-height: 20px;
    margin-bottom: 9px;

}

.mgb32 {
    margin-top: 48px;
    margin-bottom: 16px;
    padding: 0 10px;
}

.index-btn {
    background: url("https://h.4399.com/images/2022/backindex_icon.png") no-repeat -9px 0;
    background-size: 28px;
    width: 40px;
    height: 38px;
    right: 0;
    background-position: 5px 14px;
    cursor: pointer;
}

.menu_top_list {
    max-width: 500px;
    margin: 0 auto;
    position: fixed;
    height: 48px;
    width: 100%;
    background-color: white;
    color: #333;
    font-size: 16px;
    font-weight: bold;

    z-index: 90;
    top: 0;
}

.menu_top_list li+li {
    width: 64%;
    -webkit-box-pack: center;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.menu_top_list li {
    float: left;
    display: -webkit-box;
    -webkit-box-align: center;
    height: 48px;
}

.menu_top_list li:first-child {
    cursor: pointer;
    width: 18%;
    color: #BFBFBF;
    font-size: 20px
}

.menu_top_list li:last-child {
    width: 18%;
}

.menu_top_list li:first-child::before {
    background: url("https://rs.sfacg.com/web/m/images/menu_top_icon.png") no-repeat -49.216px 9.96px;
    background-size: 105.462px;
    content: "";
    height: 46.8px;
    width: 24.608px;
    display: block;
}
</style>